import {
  dateFormat
} from '../components'
class MockService {
  // 特惠数据初始化
  prefList = [{
    "id": 1001,
    "title": "拉布拉多",
    "price": "1666",
    "oldPrice": "￥1999",
    "sex": Math.random > .5 ? '弟弟' : '妹妹',
    "ster": Math.random > .5 ? '未绝育' : '绝育',
    "birthday": dateFormat(new Date(), 'YYYY年MM月DD日'),
    "descrption": [{
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "林遇见就是 - 种缘分让他成为你们家里的一份子"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "本店店主承诺你购买的宠物均有礼品赠送"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "竹林全国派送到家， 附近顺风车外地均可祥"
      }
    ],
    "src": "https://t7.baidu.com/it/u=4162611394,4275913936&fm=193&f=GIF"
  }, {
    "id": 1002,
    "title": "哈士奇",
    "price": "888",
    "oldPrice": "￥999",
    "sex": Math.random > .5 ? '弟弟' : '妹妹',
    "ster": Math.random > .5 ? '未绝育' : '绝育',
    "birthday": dateFormat(new Date(), 'YYYY年MM月DD日'),
    "descrption": [{
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "林遇见就是 - 种缘分让他成为你们家里的一份子"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "本店店主承诺你购买的宠物均有礼品赠送"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "竹林全国派送到家， 附近顺风车外地均可祥"
      }
    ],
    "src": "https://img0.baidu.com/it/u=1810930421,3320290460&fm=253&fmt=auto&app=138&f=JPEG?w=745&h=500"
  }, {
    "id": 1003,
    "title": "柴犬",
    "price": "2100",
    "oldPrice": "￥2299",
    "sex": Math.random > .5 ? '弟弟' : '妹妹',
    "ster": Math.random > .5 ? '未绝育' : '绝育',
    "birthday": dateFormat(new Date(), 'YYYY年MM月DD日'),
    "descrption": [{
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "林遇见就是 - 种缘分让他成为你们家里的一份子"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "本店店主承诺你购买的宠物均有礼品赠送"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "竹林全国派送到家， 附近顺风车外地均可祥"
      }
    ],
    "src": "https://img1.baidu.com/it/u=3903020317,1671887655&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500"
  }, {
    "id": 1004,
    "title": "加菲猫",
    "price": "888",
    "oldPrice": "￥999",
    "sex": Math.random > .5 ? '弟弟' : '妹妹',
    "ster": Math.random > .5 ? '未绝育' : '绝育',
    "birthday": dateFormat(new Date(), 'YYYY年MM月DD日'),
    "descrption": [{
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "林遇见就是 - 种缘分让他成为你们家里的一份子"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "本店店主承诺你购买的宠物均有礼品赠送"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "竹林全国派送到家， 附近顺风车外地均可祥"
      }
    ],
    "src": "https://img0.baidu.com/it/u=4235813161,1176438496&fm=253&fmt=auto&app=120&f=PNG?w=654&h=500"

  }, {
    "id": 1005,
    "title": "阿拉斯加",
    "price": "1666",
    "oldPrice": "￥1999",
    "sex": Math.random > .5 ? '弟弟' : '妹妹',
    "ster": Math.random > .5 ? '未绝育' : '绝育',
    "birthday": dateFormat(new Date(), 'YYYY年MM月DD日'),
    "descrption": [{
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "林遇见就是 - 种缘分让他成为你们家里的一份子"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "本店店主承诺你购买的宠物均有礼品赠送"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "竹林全国派送到家， 附近顺风车外地均可祥"
      }
    ],
    "src": "https://img1.baidu.com/it/u=440382770,4170816405&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=889"
  }, {
    "id": 1006,
    "title": "藏獒",
    "price": "5555",
    "oldPrice": "￥7777",
    "sex": Math.random > .5 ? '弟弟' : '妹妹',
    "ster": Math.random > .5 ? '未绝育' : '绝育',
    "birthday": dateFormat(new Date(), 'YYYY年MM月DD日'),
    "descrption": [{
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "林遇见就是 - 种缘分让他成为你们家里的一份子"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "本店店主承诺你购买的宠物均有礼品赠送"
      },
      {
        "id": Math.floor(Math.random() * 10000 + 1),
        "title": "竹林全国派送到家， 附近顺风车外地均可祥"
      }
    ],
    "src": "https://img1.baidu.com/it/u=3961148490,2238874582&fm=253&fmt=auto&app=138&f=JPEG?w=662&h=500"
  }, ]

  // 优宠精选
  excelList = [{
      "id": Math.floor(Math.random() * 10000 + 1),
      "title": "金毛",
      "price": "1588",
      "address": "四川 成都",
      "sex": Math.random > .5 ? '弟弟' : '妹妹',
      "ster": Math.random > .5 ? '未绝育' : '绝育',
      "birthday": dateFormat(new Date(), 'YYYY年MM月DD日'),
      "descrption": [{
          "id": Math.floor(Math.random() * 10000 + 1),
          "title": "林遇见就是 - 种缘分让他成为你们家里的一份子"
        },
        {
          "id": Math.floor(Math.random() * 10000 + 1),
          "title": "本店店主承诺你购买的宠物均有礼品赠送"
        },
        {
          "id": Math.floor(Math.random() * 10000 + 1),
          "title": "竹林全国派送到家， 附近顺风车外地均可祥"
        }
      ],
      "src": "https://img0.baidu.com/it/u=1200926344,2298491531&fm=253&fmt=auto&app=138&f=JPEG?w=413&h=500"
    },
    {
      "id": Math.floor(Math.random() * 10000 + 1),
      "title": "泰迪",
      "price": "888",
      "address": "上海",
      "sex": Math.random > .5 ? '弟弟' : '妹妹',
      "ster": Math.random > .5 ? '未绝育' : '绝育',
      "birthday": dateFormat(new Date(), 'YYYY年MM月DD日'),
      "descrption": [{
          "id": Math.floor(Math.random() * 10000 + 1),
          "title": "林遇见就是 - 种缘分让他成为你们家里的一份子"
        },
        {
          "id": Math.floor(Math.random() * 10000 + 1),
          "title": "本店店主承诺你购买的宠物均有礼品赠送"
        },
        {
          "id": Math.floor(Math.random() * 10000 + 1),
          "title": "竹林全国派送到家， 附近顺风车外地均可祥"
        }
      ],
      "src": "https://img0.baidu.com/it/u=2232127769,2195388883&fm=253&fmt=auto&app=138&f=JPEG?w=440&h=438"
    },
    {
      "id": Math.floor(Math.random() * 10000 + 1),
      "title": "萨摩耶",
      "price": "1888",
      "address": "北京",
      "sex": Math.random > .5 ? '弟弟' : '妹妹',
      "ster": Math.random > .5 ? '未绝育' : '绝育',
      "birthday": dateFormat(new Date(), 'YYYY年MM月DD日'),
      "descrption": [{
          "id": Math.floor(Math.random() * 10000 + 1),
          "title": "林遇见就是 - 种缘分让他成为你们家里的一份子"
        },
        {
          "id": Math.floor(Math.random() * 10000 + 1),
          "title": "本店店主承诺你购买的宠物均有礼品赠送"
        },
        {
          "id": Math.floor(Math.random() * 10000 + 1),
          "title": "竹林全国派送到家， 附近顺风车外地均可祥"
        }
      ],
      "src": "https://img0.baidu.com/it/u=1134668220,1407290898&fm=253&fmt=auto&app=138&f=JPEG?w=550&h=455"
    }
  ]

  // 最新
  newList = [{
      "id": Math.floor(Math.random() * 10000 + 1),
      "title": "约克夏",
      "time": (new Date()).getMinutes(),
      "price": "1588",
      "src": "https://img0.baidu.com/it/u=2848483741,3375166166&fm=253&fmt=auto&app=138&f=JPEG?w=417&h=500"
    },
    {
      "id": Math.floor(Math.random() * 10000 + 1) - 7,
      "title": "比熊",
      "time": (new Date()).getMinutes() - 3,
      "price": "1688",
      "src": "https://img2.baidu.com/it/u=3409811064,1464829391&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500"
    },
    {
      "id": Math.floor(Math.random() * 10000 + 1),
      "title": "英短",
      "time": (new Date()).getMinutes() - 1,
      "price": "1500",
      "src": "https://img2.baidu.com/it/u=3607380523,3473817974&fm=253&fmt=auto&app=138&f=JPEG?w=596&h=496"
    }
  ]

  // 轮播区
  bannerList = [{
      "id": Math.floor(Math.random() * 10000 + 1),
      "src": "https://img2.baidu.com/it/u=1658827304,3507411180&fm=253&fmt=auto&app=138&f=JPEG?w=510&h=340"
    },
    {
      "id": Math.floor(Math.random() * 10000),
      "src": "https://img2.baidu.com/it/u=825422308,3178946531&fm=253&fmt=auto&app=120&f=JPEG?w=1422&h=800"
    },

    {
      "id": Math.floor(Math.random() * 10000 + 2),
      "src": "https://img1.baidu.com/it/u=1786992897,3275540373&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=313"
    },
    {
      "id": Math.floor(Math.random() * 10000 + 2),
      "src": "https://img0.baidu.com/it/u=1112393434,1912237896&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500"
    },
    {
      "id": Math.floor(Math.random() * 10000 + 2),
      "src": "https://img2.baidu.com/it/u=412568982,3522262775&fm=253&fmt=auto&app=120&f=JPEG?w=1366&h=768"
    }

  ]

  getPrefListApi() {
    return new Promise(resolve => {
      let _result = this.prefList
      resolve({
        code: 200,
        data: {
          rows: _result,
          total: this.prefList.length
        }
      })
    })
  }


  getExcelListApi() {
    return new Promise(resolve => {
      let _result = this.excelList
      resolve({
        code: 200,
        data: {
          rows: _result,
          total: this.excelList.length
        }
      })
    })
  }

  getNewListApi() {
    return new Promise(resolve => {
      let _result = this.newList
      resolve({
        code: 200,
        data: {
          rows: _result,
          total: this.newList.length
        }
      })
    })
  }

  getbannerListApi() {
    return new Promise(resolve => {
      let _result = this.bannerList
      resolve({
        code: 200,
        data: {
          rows: _result,
          total: this.bannerList.length
        }
      })
    })
  }


}

export default new MockService()
